package com.tsystems.tuni.sportplanet.dao;

import java.util.List;

import javax.persistence.Query;

import com.tsystems.tuni.sportplanet.entity.Game;
import com.tsystems.tuni.sportplanet.entity.Sport;

/**
 * 
 * @author Yuriy Eremin
 * 
 */
public class GameDAOImpl extends GenericDAOImpl<Game> implements GameDAO {

	public GameDAOImpl() {
		super();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Game> getGamesBySport(Sport sport) {
		Query query = em
				.createQuery("select g from Game as g where g.sport=:sport");
		query.setParameter("sport", sport);
		return query.getResultList();
	}

}
